function setDestinations(target_id, window_id){
  var dest_list = '';
  if(document.destinations.elements['friends_list']){
    if(document.destinations.elements['friends_list'].length){
      for(i = 0; i < document.destinations.elements['friends_list'].length; i++){
        if(document.destinations.elements['friends_list'][i].checked == true){
          if(dest_list == ''){
            dest_list += document.destinations.elements['friends_list'][i].value;
          }else{
            dest_list += ", " + document.destinations.elements['friends_list'][i].value;
          }
        }
      }
    }else{
      dest_list = $('friends_list').value;
    }
  }
  parent.$(target_id).value = dest_list;
  parent.Windows.close(window_id);
}

